package spring;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyTest {

    @Test
    public void test(){
/*
        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("beans.xml");
       // Car car= (Car) applicationContext.getBean("car");
        Car car2=applicationContext.getBean("myCar2",Car.class);
        Car car3=applicationContext.getBean("myCar3", Car.class);
      //  System.out.println(car);
        System.out.println(car2);
        System.out.println(car3);
        Human zhangsan=applicationContext.getBean("zhangsan", Human.class);
        System.out.println(zhangsan);
        Human lisi=applicationContext.getBean("lisi", Human.class);
        System.out.println(lisi);
*/

        ApplicationContext applicationContext=new ClassPathXmlApplicationContext("aop.xml");
        Math math = applicationContext.getBean("math",Math.class);
        math.add();
        math.subtract();
        math.plus();
    }
}
